package
{
	import flash.geom.Matrix;
	import flash.display.Shape;
	import flash.utils.Dictionary;
	import flash.display.Bitmap;
	import flash.display.BitmapData;

	public class ArrowBitmap extends Bitmap
	{
		private static var dictionary:Dictionary = new Dictionary();
		
		public function ArrowBitmap(radius:Number = 1, color:uint = 0xFFFFFF)
		{
			super();
			
			var bitmapdata:BitmapData = dictionary[""+radius+color];
			
			if(bitmapdata == null)
			{
				var s:Shape = new Shape();
				
					s.graphics.clear();
					s.graphics.beginFill( color );
					
					s.graphics.moveTo(radius *1.5, 0);
					
					s.graphics.lineTo(-radius*.7, radius*.7);
					s.graphics.lineTo(-radius * .4, 0);
					
					s.graphics.lineTo(-radius*.7, -radius*.7);
					s.graphics.moveTo(radius, 0);
					
					s.graphics.endFill();
				
				bitmapdata = new BitmapData(radius*2+2, radius*2+2, true, 0);
				bitmapdata.draw(s, new Matrix(1,0,0,1,radius+1,radius+1));
				dictionary[""+radius+color] = bitmapdata;
			}
			
			this.bitmapData = bitmapdata;
		}
	}
}
